home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 1.iso / ARGONET / PD / MATHS / RLAB / RLAB125.ZIP / !RLaB / help_ai / fvscope < prev    next >
Text File  |  1994-09-17  |  2KB  |  58 lines

  1. fvscope:
  2.  
  3. Syntax:    fvscope ( FNAME )
  4.     fvscope ( FNAME , FILE )
  5. Description:
  6.  
  7.     The fvscope function examines the compiled form of the
  8.     user-function, identified by FNAME, and prints a listing of
  9.     all the variables used within the function. Additionally the
  10.     scope of each variable is printed.
  11.  
  12.     The second, and optional argument, is a string that denoted a
  13.     filename, or output process for fvscope to write it's output
  14.     to. 
  15.  
  16.     Fvscope is useful for writing general purpose functions that
  17.     will be used by others. It can be used to identify errant
  18.     global variables (variables that should be local, but were
  19.     overlooked). 
  20.  
  21.     Example:
  22.  
  23.     > x = function ( y )
  24.       {
  25.         local (z)
  26.       
  27.         z = 2*y + zz;
  28.         return z
  29.       }
  30.         <user-function>
  31.     > fvscope (x);
  32.         Function Variable SCOPE analysis for : x
  33.         Filename: stdin
  34.     
  35.         line    GLOBAL            ARG        LOCAL
  36.     
  37.            1                        Local-Var: z
  38.            1                Arg-Var: y
  39.            1    Global-Var: zz*
  40.            1                        Local-Var: z
  41.  
  42.     The above example shows a trivial user-function, and the
  43.     output from fvscope. Notice the typo on the 5th line of the
  44.     function (`z = 2*y + zz;'), which should have read: `z = 2*y +
  45.     z;'. Fvscope identifies the variable `zz' as a global
  46.     variable, signaling the function author (who did not want to
  47.     use any global variables) that there is a potential error.
  48.  
  49.     Global variable references, to variables that are not
  50.     functions are flagged with an asterisk (`*') to help users
  51.     identify variables that are not class function.
  52.  
  53.     Also note that the line numbers in the above example are all
  54.     1. In this particular case (the function is entered at the
  55.     command line) this behavior is correct. When running fvscope()
  56.     on a function that is stored in a file, the proper line
  57.     numbers will be reported.
  58.